﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InnovTech.Util.Workflow
{
    public class Decision<TInput> : WorkStep<TInput, bool>
    {
        public IWorkStep TrueStep { get; set; }
        public IWorkStep FalseStep { get; set; }

        public Decision(Func<TInput, bool> logic)
            : base(logic)
        {
            GetNextStep = isTrue =>
            {
                if ((bool)isTrue)
                    return TrueStep;
                return FalseStep;
            };
        }
    }
}
